HAL SMARTCARD state and error functions migration

This section provides information about the HAL SMARTCARD state and error functions migration.

HAL_SMARTCARD_GetState

The function HAL_SMARTCARD_GetState remain unchanged.

HAL1

HAL2

HAL_SMARTCARD_GetState(const SMARTCARD_HandleTypeDef *hsc)
HAL_SMARTCARD_GetState(const hal_smartcard_handle_t *hsmartcard)

Related concepts: Revised and optimized HAL state machine


HAL_SMARTCARD_GetError

HAL1

HAL2

Description

In HAL1, the function HAL_SMARTCARD_GetError() returns the SMARTCARD error code. The SMARTCARD error code can be a combination (bitfields) of the following values:

  • HAL_SMARTCARD_ERROR_NONE

  • HAL_SMARTCARD_ERROR_PE

  • HAL_SMARTCARD_ERROR_NE

  • HAL_SMARTCARD_ERROR_FE

  • HAL_SMARTCARD_ERROR_ORE

  • HAL_SMARTCARD_ERROR_RTO

  • HAL_SMARTCARD_ERROR_DMA

  • //

  • //

  • HAL_SMARTCARD_ERROR_INVALID_CALLBACK

In HAL2, the function HAL_SMARTCARD_GetLastErrorCodes() retrieves the last error codes for the SMARTCARD. The SMARTCARD last error codes can be a combination (bitfields) of the following values:

  • HAL_SMARTCARD_ERROR_NONE

  • HAL_SMARTCARD_RECEIVE_ERROR_PE

  • HAL_SMARTCARD_RECEIVE_ERROR_NE

  • HAL_SMARTCARD_RECEIVE_ERROR_FE

  • HAL_SMARTCARD_RECEIVE_ERROR_ORE

  • HAL_SMARTCARD_RECEIVE_ERROR_RTO

  • HAL_SMARTCARD_RECEIVE_ERROR_DMA

  • HAL_SMARTCARD_TRANSMIT_ERROR_DMA

  • HAL_SMARTCARD_TRANSMIT_ERROR_NACK

Function name

HAL_SMARTCARD_GetError(const SMARTCARD_HandleTypeDef *hsc)
HAL_SMARTCARD_GetLastErrorCodes(const hal_smartcard_handle_t *hsmartcard)

Note

In HAL2, the constant HAL_SMARTCARD_ERROR_INVALID_CALLBACK has been removed. Instead, functions HAL_SMARTCARD_RegisterXXXCallback() return HAL_INVALID_PARAM in case of an invalid callback pointer.

Related concepts: Revised and optimized HAL error management.